package com.bing.bean.Tpp.tuling;

import com.bing.bean.weixin.Article;
import com.bing.bean.weixin.RequestMessage;
import com.bing.bean.weixin.ResponseMessage;
import com.bing.utils.MsgHelper;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by Administrator on 2015/6/6.
 */
public class CaiPus extends AbstractMsg {
    private List<CaiPu> list;

    public List<CaiPu> getList() {
        return list;
    }

    public void setList(List<CaiPu> list) {
        this.list = list;
    }

    @Override
    public ResponseMessage toMsg(RequestMessage requestMessage) {
        List<Article> articles = new ArrayList<>();
        int i=1;
        for (CaiPu n : list) {
            if(i>10){
                break;
            }
            i++;
            Article article = new Article();
            article.setContent(n.getInfo());
            article.setDescription(n.getInfo());
            article.setPicUrl(n.getIcon());
            article.setUrl(n.getDetailurl());
            article.setTitle(n.getName()+" "+n.getInfo());
            articles.add(article);
        }
        return MsgHelper.toNews(requestMessage, articles);
    }

    public class CaiPu {
        private String name;
        private String info;
        private String detailurl;
        private String icon;

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        public String getInfo() {
            return info;
        }

        public void setInfo(String info) {
            this.info = info;
        }

        public String getDetailurl() {
            return detailurl;
        }

        public void setDetailurl(String detailurl) {
            this.detailurl = detailurl;
        }

        public String getIcon() {
            return icon;
        }

        public void setIcon(String icon) {
            this.icon = icon;
        }
    }
}
